<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var obj1 = {
            name: 1,
            age: 2
        }
        var obj2 = {
            kk: 3,
            gg: 4
        }
        var obj3 = Object.assign(obj1, obj2)
        obj3.name = "张三"
            // ... 扩展运算符 深拷贝
            //              目标对象  要合并的对象      
            // Object.assign(target, obj) 浅拷贝
        var obj4 = {...obj1,
            ...obj2
        }
        obj4.kk = 8888;
        console.log(obj3)
        console.log(obj4)
        console.log(obj2)
        console.log(obj1)
    </script>
</body>

</html>